package cn.edu.ctgu.geo.type;


// 定义 LngLat 类，对应 TypeScript 中的 LngLat 类型
public class LngLat {
    private double lngDegree;
    private double lngMinute;
    private double lngSecond;
    private LngDirection lngDirection;
    private double latDegree;
    private double latMinute;
    private double latSecond;
    private LatDirection latDirection;

    // 构造函数
    public LngLat(double lngDegree, double latDegree) {
        this.lngDegree = lngDegree;
        this.latDegree = latDegree;
    }

    // 全参数构造函数
    public LngLat(double lngDegree, double lngMinute, double lngSecond, LngDirection lngDirection,
                  double latDegree, double latMinute, double latSecond, LatDirection latDirection) {
        this.lngDegree = lngDegree;
        this.lngMinute = lngMinute;
        this.lngSecond = lngSecond;
        this.lngDirection = lngDirection;
        this.latDegree = latDegree;
        this.latMinute = latMinute;
        this.latSecond = latSecond;
        this.latDirection = latDirection;
    }

    public LngLat() {

    }

    public LngLat(LngLat other) {
        this.latDirection = other.latDirection;
        this.lngDirection = other.lngDirection;
        this.latMinute = other.latMinute;
        this.lngMinute = other.lngMinute;
        this.latSecond = other.latSecond;
        this.lngSecond = other.lngSecond;
        this.latDegree = other.latDegree;
        this.lngDegree = other.lngDegree;
    }

    // Getter 和 Setter 方法
    public double getLngDegree() {
        return lngDegree;
    }

    public void setLngDegree(double lngDegree) {
        this.lngDegree = lngDegree;
    }

    public Double getLngMinute() {
        return lngMinute;
    }

    public void setLngMinute(double lngMinute) {
        this.lngMinute = lngMinute;
    }

    public Double getLngSecond() {
        return lngSecond;
    }

    public void setLngSecond(double lngSecond) {
        this.lngSecond = lngSecond;
    }

    public LngDirection getLngDirection() {
        return lngDirection;
    }

    public void setLngDirection(LngDirection lngDirection) {
        this.lngDirection = lngDirection;
    }

    public String getLngStr() {
        return lngDegree + "° " + lngMinute + "' " + String.format("%.6f", lngSecond) + "\" "
                + lngDirection.name();
    }

    public String getLatStr() {
        return latDegree + "° " + latMinute + "' " + String.format("%.6f", latSecond) + "\" "
                + latDirection.name();
    }

    @Override
    public String toString() {
        return "经度：" + getLngStr() + ",纬度：" + getLatStr();
    }

    public double getLatDegree() {
        return latDegree;
    }

    public void setLatDegree(double latDegree) {
        this.latDegree = latDegree;
    }

    public Double getLatMinute() {
        return latMinute;
    }

    public void setLatMinute(double latMinute) {
        this.latMinute = latMinute;
    }

    public Double getLatSecond() {
        return latSecond;
    }

    public void setLatSecond(double latSecond) {
        this.latSecond = latSecond;
    }

    public LatDirection getLatDirection() {
        return latDirection;
    }

    public void setLatDirection(LatDirection latDirection) {
        this.latDirection = latDirection;
    }
}




